//
//  UIView+ShowPromptMessage.m
//  1gene
//
//  Created by 1jiyin on 16/3/15.
//  Copyright © 2016年 1jiyin. All rights reserved.
//

#import "UIView+ShowPromptMessage.h"
#define MaxTag 100000
@implementation UIView (ShowPromptMessage)
-(void)showPromptMessage:(BOOL)isShow and:(NSString *)message
{
    if (isShow) {
         UIView *view1=(id)[self viewWithTag:MaxTag];
        if (view1==nil) {
            view1=[[UIView alloc]init];
            view1.tag=MaxTag;
            view1.bounds=CGRectMake(0, 0, 150, 30);
            view1.center=self.center;
            view1.backgroundColor=[UIColor grayColor];
            [self addSubview:view1];
            UILabel *lab=[[UILabel alloc]initWithFrame:view1.bounds];
            lab.text=message;
            lab.font=[UIFont systemFontOfSize:12];
            lab.textAlignment=NSTextAlignmentCenter;
            lab.textColor=[UIColor whiteColor];
            [view1 addSubview:lab];
        }
    }else{
        UIView *view1=(id)[self viewWithTag:MaxTag];
        [view1 removeFromSuperview];
    }
}
@end
